//
//  TopicHeaderView.m
//  Findif
//
//  Created by Mac on 2019/2/25.
//  Copyright © 2019年 Cicel Chen. All rights reserved.
//

#import "TopicHeaderView.h"

@interface TopicHeaderView ()

@property (nonatomic, strong)UIView * oneLineView;
@property (nonatomic, strong)UIView * twoLineView;

@end

@implementation TopicHeaderView


- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    
    self.oneLineView = [self setupLineView];
    [self addSubview:self.oneLineView];
    self.twoLineView = [self setupLineView];
    [self addSubview:self.twoLineView];
    
    UILabel * titleLabel = [UILabel new];
    
    titleLabel.textColor = ColorWithRGB(0x909090);
    titleLabel.font = [UIFont systemFontOfSize:13 * SCREENH6];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    
    self.titleLabel = titleLabel;
    
    [self addSubview:self.titleLabel];
}


- (void)layoutSubviews{
    
    [self.oneLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.leading.mas_equalTo(self).offset(15 * SCREENH6);
        make.height.mas_equalTo(1 * SCREENH6);
        make.width.mas_equalTo(135 * SCREENH6);
    }];
    
    [self.twoLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(self).offset(-15 * SCREENH6);
        make.centerY.width.height.mas_equalTo(self.oneLineView);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.centerX.mas_equalTo(self);
    }];
}


- (UIView *)setupLineView{
    
    UIView * lineView = [UIView new];
    
    lineView.backgroundColor = ColorWithRGB(0xe4e4e4);
    
    return lineView;
}

@end
